package net.helix.engine.library.items;

import java.util.ArrayList;

import net.helix.element.Element;
import net.helix.engine.Engine;
import net.helix.engine.library.Library;
import net.helix.engine.properties.Properties;

public abstract class LibraryItem {
	static final int NULL_ID = -1;
	public int id = NULL_ID;
	public String name;
	public LibraryItemType type = null;
	
	private ArrayList<Properties> presets;
	private Properties defaultPreset;
	
	/**
	 * If library is null, it should mean that this
	 * LibraryItem is not in the library.
	 */
	private Library library;
	
	/**
	 * Create a library item. Note, the render function for library
	 * items are specific for rendering to the library.
	 * @param name
	 */
	public LibraryItem(Library library, String name){
		this.name = name;
		this.library = library;
		
		defaultPreset = makeDefaultProperties();
		
		presets = new ArrayList<Properties>();
		presets.add(defaultPreset);
	}
	public abstract Properties makeDefaultProperties();
	public Properties getDefaultPreset(){
		return defaultPreset;
	}
	public void setDefaultPreset(Properties preset){
		defaultPreset = preset;
	}
	
	public enum LibraryItemType{
		IMAGE ("Image"), SOUND ("Sound"), MATERIAL ("Material"), MESH ("Mesh"), MODEL("Model");
		public String name;
		LibraryItemType(String name){
			this.name = name;
		}
	}
	public void dispose(){
		
	}
	
	public Library getLibrary(){
		return library;
	}
	
	public abstract void renderLibrary(Engine engine, int width, int height);
	public abstract void render(Properties properties);
	public abstract Element createElement();
	
}
